package org.masterview.showcase.user.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import org.masterview.user.client.ui.*;
import org.masterview.user.client.data.DataSourceImpl;
import com.google.gwt.core.client.GWT;

import java.util.List;
import java.util.ArrayList;
import java.util.Date;

public class MasterviewExample implements EntryPoint
{
    public void onModuleLoad() {        
        
        List albums = new ArrayList();
		for (int i = 0; i < 50; i++) {
			albums.add(new Album("Album #" + i, "Artist #" + i, i, "Some genre"));
		}

		MasterView masterView = (MasterView) GWT.create(Album.class);
		masterView.setItems(albums);		
		
		masterView.appendColumn(new Column("name", "Name", true, "25%"));
		masterView.appendColumn(new Column("artist", "Artist", true, "20%"));
		masterView.appendColumn(new Column("year", "Year of recording", true, "25%"));
		masterView.appendColumn(new Column("genre", "Genre", true, "30%"));	
	
		masterView.setFilteringEnabled(true);
		masterView.setPageSize(10);
			
		RootPanel.get().add(masterView);   
    }
}